{% extends 'admin/master.html' %}
{% import 'admin/lib.html' as lib with context %}

{% block head %}
  {{ super() }}
  {{ lib.form_css() }}
{% endblock %}

{% block nav_menu_bar %}
<ul class="nav nav-tabs actions-nav">
    <li>
        <a href="{{ return_url }}">{{ _gettext('List') }}</a>
    </li>

    {% if admin_view.can_create %}
    <li>
      {%- if admin_view.create_modal -%}
        {{ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), title=_gettext('Create new record'), content=_gettext('Create')) }}
      {% else %}
        <a href="{{ get_url('.create_view', url=return_url) }}" title="{{ _gettext('Create new record') }}">{{ _gettext('Create') }}</a>
      {%- endif -%}
    </li>
    {% endif %}

    {% if admin_view.tabs %}
        {% for tab in admin_view.tabs %}
            {% if request.endpoint.endswith(tab.endpoint) %}
            <li class="active">
                <a href="javascript:void(0);" title="{{ tab.title }}">{{ tab.text }}</a>
            </li>
            {% else %}
            <li>
                <a href="{{ get_url(tab.endpoint, url=return_url) }}" title="{{ tab.title }}">{{ tab.text }}</a>
            </li>
            {% endif %}
        {% endfor %}
    {% endif %}
</ul>
{% endblock %}

{% block body %}
  {% block main %}{% endblock %}
{% endblock %}

{% block tail %}
  {{ super() }}
  {{ lib.form_js() }}
{% endblock %}
